home *** CD-ROM | disk | FTP | other *** search
/ Mastering Microsoft Visual Basic 5 / Mastering Microsoft Visual Basic 5.ISO / media / ch02 / v02d010.cc < prev    next >
Text File  |  1997-01-24  |  5KB  |  53 lines

  1. 0, In this demonstration we'll look at using the Data Form Wizard to automate the process of building database front ends.
  2. 8, The Data Form Wizard is an add-in provided with Visual Basic.
  3. 12,  In order to use this add-in, we must first load it using the add-in manager.
  4. 16,  The way we do that is to go the Add-Ins menu, select Add-In manager, and in the Add-In manager dialogùwe'll choose the VB Data Form Wizard option and click OK.
  5. 28,  Now if we go back to the Add-Ins menu, we'll notice that we have a new option, called Data Form Wizard.
  6. 34,  We'll go ahead and select that and this will start the Data Form Wizard.
  7. 38,  Now the first thing that we need to do in the Data Form Wizard is select the type of database that we want to get our information from.
  8. 45,  We'll actually use an Access database, but before we do that I'd just like to mention that we also can access remote ODBC data as well.
  9. 52,  If I choose Next here, you'll see that we can actually build database front ends that get to remote data in much the same way that we'll build a front end to an Access database.
  10. 61, Let's go ahead and go back now and select our Access database.
  11. 65,  And I'll choose the Next button again and here I'm prompted for the name of the database.
  12. 70,  And we'll use the Northwind database that comes with Visual Basic.
  13. 76,  Then we'll choose Next and then we're prompted for the type of database front end that we want to build.
  14. 82,  And there's three types of forms that the Data Form Wizard will build for us.
  15. 86,  A single record form in which we see one record at a time, and we can edit all the fields in that record.
  16. 92,  A grid or data sheet form in which we see multiple records at a time and we can actually edit any of those records at a time.
  17. 100,  And then finally, a master detail form, which is a combination of single record and grid data sheet form.
  18. 107,  Here, we have the master portion at the top and the detail portion at the bottom, which are actually provided from two separate tables.
  19. 116,  We'll go ahead and choose a master detail form and we'll see how that's created.
  20. 121, Go ahead and click the Next button and now we're prompted for the master portion of this form.
  21. 126,  In this case we'll go ahead and use the categories table.
  22. 130,  And then we're prompted to select fields from that table and we'll choose all of those fields.
  23. 135,  And again click the Next button and now we're prompted for the detail portion of the form.
  24. 141,  And in this case we'll use the products table.
  25. 143,  And again we'll use all of those fields.
  26. 146,  And again we want to move on to the next screen in the Data Form Wizard.
  27. 151,  And here we're prompted for a field that links these two tables together.
  28. 154,  When we're building a master detail form there needs to be a one-to-many relationship between one of the fields and the two tables.
  29. 161,  And in this case, that field is the category ID field.
  30. 164,  So we'll go ahead and pick that field in both of the tables, click the next button again, and here we're prompted for the controls that we'd like to appear at the bottom of our database form.
  31. 173,  And we'll go ahead and just leave all of those selected and choose Next again.
  32. 177,  And then finally, we're prompted to give the form a name, and it's just called frmCategories by default, and then we choose the Finish button and the Data Form Wizard will build that form for us.
  33. 188,  So here, we see that form built for us.
  34. 192, Now one of the things about this particular form that we designed is that it has a picture field.
  35. 196,  So I'm going to make a little bit more room for that field by moving down some of the other fields.
  36. 201,  And we'll go ahead and just size this picture field then to display that picture a little bit better.
  37. 206,  Now in order to see this form as a part of our application, we need to set this form as a startup window and we'll do that by going to the project menu, selecting project properties.
  38. 218,  And in the startup object drop down list, we'll select the form name and we'll choose OK.
  39. 225, Now we can go ahead and run our form.
  40. 228,  And here we see the form that was built by the Data Form Wizard.
  41. 232,  Notice now, as I scroll through the form, I'm actually scrolling through the records in the master table and then I'm seeing all the associated records in the details table.
  42. 241,  So here's the categories and all the products that are part of that categories.
  43. 245,  And I can edit records in either one of these tables.
  44. 248,  So I can add some more information here or I can go down to an actual product name and add information as well.
  45. 256,  And we can navigate to record to record and also to the end and the beginning of the recordset.
  46. 262,  And we can also add, delete or update these records as we're viewing them in our form.
  47. 268, Let's go ahead and end this application.
  48. 270,  And again, here we see our form.
  49. 272,  It's important to note that we build a master detail form.
  50. 274,  We're actually again building a form which uses two tables and we also are using two data controls.
  51. 280,  Here's the first data control, which is invisible and the second data control which we use to navigate through the information.
  52. 287, So what we've seen in this demonstration is how the Data Form Wizard can automate much of the work involved with building a database front-end.
  53. 294, END